﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Huioo.Learning.Agile.Payroll.Domain
{
    class UnionAffiliation
    {

        public double CalculateDeductions(Paycheck paycheck)
        {
            double totalDues = 0;
            int fridays = NumberOfFridaysInPayPeriod(
              paycheck.PayPeriodStartDate, paycheck.PayPeriodEndDate);
            totalDues = dues * fridays;
            return totalDues;
        }

        private int NumberOfFridaysInPayPeriod(
          DateTime payPeriodStart, DateTime payPeriodEnd)
        {
            int fridays = 0;
            for (DateTime day = payPeriodStart;
              day <= payPeriodEnd; day.AddDays(1))
            {
                if (day.DayOfWeek == DayOfWeek.Friday)
                    fridays++;
            }
            return fridays;
        }

    }
}
